package com.dd.dao;

import java.util.Date;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;

import com.dd.entity.DdShopreject;
import com.dd.entity.DdSms;

public class DdShoprejectDAO extends HibernateDaoSupport{
	private static final Log log = LogFactory.getLog(DdShoprejectDAO.class);
	public void saveOrUpdate(DdShopreject transientInstance) {
		log.debug("saving DdShopreject instance");
		try {
			getHibernateTemplate().saveOrUpdate(transientInstance);
			log.debug("save successful");
		} catch (RuntimeException re) {
			log.error("save failed", re);
			throw re;
		}
	}
	public void delete(DdShopreject persistentInstance) {
		log.debug("deleting DdShopreject instance");
		try {
			getHibernateTemplate().delete(persistentInstance);
			log.debug("delete successful");
		} catch (RuntimeException re) {
			log.error("delete failed", re);
			throw re;
		}
	}
	public DdShopreject findById(java.lang.Integer id) {
		log.debug("getting DdShopreject instance with id: " + id);
		try {
			DdShopreject instance = (DdShopreject) getHibernateTemplate().get(
					"com.dd.entity.DdShopreject", id);
			return instance;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
	//检测是否传入时间已经满座
	public boolean checkReject(int shopid,String date,int loge) {
		log.debug("checkReject---shopid:"+shopid+" date:"+date);
		boolean flag= false;
		try {
			
			List li=getHibernateTemplate().find("from DdShopreject where shopid="+shopid +" and rejectdate='"+date+"' and loge="+loge);
			if(li.size()>0){
				flag=true;
			}
			return flag;
		} catch (RuntimeException re) {
			log.error("get failed", re);
			throw re;
		}
	}
	
}
